# _*_ coding : utf-8 _*_
# @Time: 2024/9/24 15:33
# @Author : 石文帅	
# @File : slfhWorkbench.py
# @Project : python_slfh

from selenium import webdriver
import unittest
import time
import logging
from selenium.webdriver.common.by import By

from common.basice import *
from common.getini import get_db_data
from xpathDictionary.slfhXpath import *


def login(self, user=get_db_data('pageboys', 'account'), passwd=get_db_data('pageboys', 'password'), target='工作台'):
    """
    登录，默认是登录管理员
    :param self:
    :param user: 账户，默认slfhadmin
    :param passwd: 密码，默认slfhadmin的密码
    :param target: 登录后判断登录成功的目标，默认工作台,另外2个必须是 指挥中心、实况中心
    :return:
    """
    log.info('打开页面')
    locate_input(self, loginPage['登录账户'], user)
    locate_input(self, loginPage['登录密码'], passwd)

    log.info('输入验证码')
    locate_input(self, loginPage['登录验证码'], get_db_data('pageboys', 'code'))
    locate_click(self, loginPage['登录按钮'])
    if element_exist(self, loginPage[f'登录后的首页logo-{target}'], 10):
        log.info('登录成功')
    else:
        raise log.info('登录失败')


def logout(self):
    """
    退出登录
    :return:
    """
    log.info('点击头像退出登录')
    locate_click(self, homepage['头像'])
    locate_click(self, homepage['退出登录'])
    locate_click(self, homepage['退出登录确定'])
    log.info('断言是否退出登录了')
    assert_str_element(self, '登录', loginPage['登录按钮'])


def change_passwd(self, old_passwd, new_passwd, again_new_passwd):
    """
    修改当前密码
    :param self:
    :param old_passwd: 老密码
    :param new_passwd: 新密码
    :param again_new_passwd: 再次输入新密码
    :return:
    """
    log.info('输入原密码、新密码 并确认提交')
    locate_input(self, homepage['原密码'], old_passwd)
    locate_input(self, homepage['新密码'], new_passwd)
    locate_input(self, homepage['确认密码'], again_new_passwd)
    locate_click(self, homepage['确认修改密码'])


def set_homepage(self, home_page):
    """
    设置首页，当前界面要在工作台界面
    :param self:
    :param home_page:工作台、指挥中心、实况中心
    :return:
    """
    log.info(f'点击设置首页，设置登录后的首页为{home_page}')
    locate_click(self, loginPage[f'登录后的首页logo-工作台'])
    locate_click(self, homepage[f'设置首页-{home_page}'])
    locate_click(self, homepage['设置首页确定'])
    log.info('断言是否设置成功')
    assert_str_element(self, '保存成功', homepage['保存成功'])
    locate_click(self, loginPage[f'登录后的首页logo-工作台'])
    assert_str_element(self, home_page, homepage['当前选中首页'])
    locate_click(self, homepage['设置首页取消'])


def back_homepage(self):
    """
    指挥中心返回工作台界面，涉及到打开新页面
    :param self:
    :return:
    """
    log.info('点击返回工作台按钮')
    locate_click(self, homepage['大屏返回工作台按钮'])

    log.info('出现新页面')
    log.info('获取所有打开窗口的句柄')
    window_handles = self.window_handles

    log.info('切换到新窗口，也就是最后一个窗口')
    self.switch_to.window(window_handles[-1])

    # 切换回原始窗口
    # self.switch_to.window(window_handles[0])


def search_menu(self, menu):
    """
    搜索并点击menu菜单
    :param self:
    :param menu: 菜单名字
    :return:
    """
    locate_input(self, homepage['搜索框'], menu)
    if element_exist(self, homepage['搜索框下拉第一条']):
        locate_click(self, homepage['搜索框下拉第一条'])
    else:
        log.info('菜单不存在')
        raise


# 网格管理---------------------------------------------------------------------------------
def edit_grid(self, grid_name, grid_new_name, grid_len, name_list):
    """
    编辑网格
    :param self:
    :param grid_name:要编辑的网格名称
    :param grid_new_name:编辑后的网格名称
    :param grid_len:网格长度
    :param name_list:网格人员
    :return:
    """
    log.info('编辑网格开始')
    locate_click(self, f'//*[contains(text(), "{grid_name}")]')
    log.info('点击所选网格的编辑')
    locate_click(self, grid['选中网格的修改'])
    if grid_name != grid_new_name:
        log.info(f'修改网格名字{grid_new_name}')
        locate_input(self, grid['编辑网格名称'], grid_new_name)
    locate_input(self, grid['编辑网格长度'], grid_len)

    old_name_list = locate_text(self, grid['编辑网格人员']).split(',')
    log.info(f'old_name_list:{old_name_list}')

    add_list, del_list = list_comparison(old_name_list, name_list)
    if add_list is not None and add_list != ['选择网格人员']:
        log.info(f'开始新增人:{add_list}')
        for add in add_list:
            locate_click(self, grid['编辑网格人员'])
            locates_last_input(self, grid['搜索网格人员'], add)
            time.sleep(0.5)
            locates_last_click(self, f'//*[contains(text(), "{add}")]')
            time.sleep(0.5)
            locates_last_click(self, grid['勾选点击的人'])
            locate_click(self, grid['编辑网格人员'])

    if del_list is not None and del_list != ['选择网格人员']:
        log.info(f'开始删除人{del_list}')
        for deleted in del_list:
            locate_click(self, grid['编辑网格人员'])
            locates_last_input(self, grid['搜索网格人员'], deleted)
            time.sleep(0.5)
            locates_last_click(self, f'//*[contains(text(), "{deleted}")]')
            time.sleep(0.5)
            locates_last_click(self, grid['取消选中'])
            locate_click(self, grid['编辑网格人员'])

    log.info('编辑确认')
    locate_click(self, grid['编辑确定'])
    time.sleep(1)
    assert_equal(locate_text(self, fire_configuration['操作成功']), '操作成功')


def search_grid(self, people_name=None, up_grid_name=None, grid_name=None, post=None):
    """
    网格人员搜索
    :param self:
    :param up_grid_name: 上级网格
    :param people_name: 人员名称
    :param grid_name: 网格名称
    :param post: 岗位
    :return:
    """
    log.info('网格人员搜索')
    if people_name is not None:
        locate_slfh_clear(self, grid['搜索-人员名称'])
        locate_input(self, grid['搜索-人员名称'], people_name)
    else:
        locate_slfh_clear(self, grid['搜索-人员名称'])
    time.sleep(0.1)
    if up_grid_name is not None:
        locate_slfh_clear(self, grid['搜索-上级网格'])
        locate_input(self, grid['搜索-上级网格'], up_grid_name)
    else:
        locate_slfh_clear(self, grid['搜索-上级网格'])
    time.sleep(0.1)
    if grid_name is not None:
        locate_slfh_clear(self, grid['搜索-网格名称'])
        locate_input(self, grid['搜索-网格名称'], grid_name)
    else:
        locate_slfh_clear(self, grid['搜索-网格名称'])
    time.sleep(0.1)
    if post is not None:
        locate_click(self, grid['搜索-岗位'])
        time.sleep(0.5)
        locates_last_click(self, f'//*[contains(text(), "{post}")]')
    else:
        mouse_hover(self, grid['搜索-岗位'])
        time.sleep(0.5)
        element_exist_click(self, grid['搜索-岗位删除'], 1)
    locate_click(self, grid['搜索-查询'])
    time.sleep(1)
# 网格管理---------------------------------------------------------------------------------


# 知识库---------------------------------------------------------------------------------—-
def edit_knowledge(self, name=None, describe=None, photo=None):
    """
    新增/编辑知识库，前提要先点击新增或者编辑，包含提交操作
    :param self:
    :param name:名称
    :param describe:描述
    :param photo:图片
    :return:
    """
    if name is not None:
        locate_input(self, knowledge['名称'], name)
    else:
        locate_clear(self, knowledge['名称'])
    if describe is not None:
        locate_input(self, knowledge['描述'], name)
    else:
        locate_clear(self, knowledge['描述'])
    if photo is not None:
        locate_click(self, knowledge['封面模版'])
        locate_click(self, knowledge[photo])
    else:
        if element_exist(self, knowledge['图片删除'], num=1):
            mouse_hover(self, knowledge['图片删除'])
            locate_click(self, knowledge['图片删除'])
    locate_click(self, knowledge['提交'])
# 知识库---------------------------------------------------------------------------------—-


# 分类资源---------------------------------------------------------------------------------
def keyword_search(self, keyword=None):
    """
    关键字搜索,不传值就清空输入框
    :param self:
    :param keyword: 关键字
    :return:
    """
    if keyword is not None:
        locate_clear(self, resources['分类资源-关键字输入框'])
        time.sleep(1)
        locate_input(self, resources['分类资源-关键字输入框'], keyword)
    else:
        locate_clear(self, resources['分类资源-关键字输入框'])
    time.sleep(1)
    # 模拟点击搜索按钮,可以忽略
    locate_click(self, resources['分类资源-关键字搜索'])
    time.sleep(1)


def add_edit_resource(self, resource_name, type_name, people_name, phone_num, describe=None, state=True, img_name=None, lon=None, lat=None, address=None):
    """
    新增或者编辑资源
    :param self:
    :param resource_name: 资源名称
    :param type_name:资源类别
    :param people_name:负责人
    :param phone_num:联系电话
    :param describe:描述
    :param state:资源状态
    :param img_name:图片名称
    :param lon:经度
    :param lat:纬度
    :param address:地址，可以不输入经纬度，输入地址来搜索
    :return:
    """
    # 首先断言资源类别对不对
    assert_str_element(self, type_name, resources['新增编辑-资源类别'], '当前资源类别和预计类别不一致')
    list_target = [resource_name, people_name, phone_num]
    locates_input(self, list_target, resources['新增编辑-input标签'])
    if describe is not None:
        locate_input(self, resources['新增编辑-资源描述'], describe)
    else:
        locate_clear(self, resources['新增编辑-资源描述'])
    if lon is not None and lat is not None:
        locate_click(self, resources['新增编辑-资源地图'])
        locate_input(self, resources['新增编辑-资源地图经度'], lon)
        locate_input(self, resources['新增编辑-资源地图纬度'], lat)
        locate_click(self, resources['新增编辑-资源地图空白处'])
        time.sleep(2)
        locate_click(self, resources['新增编辑-资源地图确定'])
    if address is not None:
        locate_click(self, resources['新增编辑-资源地图'])
        locate_input(self, resources['新增编辑-资源地图搜索输入框'], address)
        locate_click(self, resources['新增编辑-资源地图搜索输入框'])
        # 可能有点卡，最多等6s
        element_exist(self, f"{resources['新增编辑-资源地图搜索下拉框']}[1]", 6)
        text = locate_text(self, f"{resources['新增编辑-资源地图搜索下拉框']}[1]")
        log.info(f'点击地图搜索下拉框第一个：{text}')
        locate_click(self, f"{resources['新增编辑-资源地图搜索下拉框']}[1]")
        time.sleep(2)
        if text == '中国石化光电园加油站':
            assert_str_element(self, '重庆市渝北区人和街道西郊汽车服务连锁光电园店', resources['新增编辑-资源地图详细地址'])
        locate_click(self, resources['新增编辑-资源地图确定'])
    if img_name is not None:
        while True:
            if element_exist(self, resources['新增编辑-资源图片按钮'], 1):
                # 有图片就删除图片
                mouse_hover(self, resources['新增编辑-资源图片按钮'])
                locate_click(self, f"{resources['新增编辑-资源图片按钮']}/../../span/i")
            else:
                break
        locate_sendImg(self, f'{path_expected_img}{img_name}', resources['新增编辑-资源图片'])
    if state:
        locates_click(self, resources['新增编辑-资源状态'], 0)
    else:
        locates_click(self, resources['新增编辑-资源状态'], 1)
    locate_click(self, resources['新增编辑-提交确认'])


def resource_search_assert(self, expectList):
    """
    资源搜索第一行断言
    :param self:
    :param expectList: 期望list
    :return:
    """
    actual_list = locates_for_list(self, resources['资源列表第一行'])
    log.info(f'当前列表{actual_list}')
    i = 0
    for expect in expectList:
        if i == 7:
            i = i+1
            continue
        assert_equal(actual_list[i], expect)
        i = i+1
    actual_time = actual_list[7].split()[0]
    assert_equal(actual_time, expectList[7])


def resource_edit_assert(self, expectList):
    """
    资源搜索第一行编辑后 断言
    :param self:
    :param expectList: 期望list
    :return:
    """
    elements = locates(self, resources['新增编辑-input标签'])
    for i in range(0, 3):
        assert_equal(elements[i].get_attribute('value'), expectList[i])
    assert_equal(locate_text(self, resources['新增编辑-资源类别']), expectList[3])
    assert_equal(get_input_value(self, resources['新增编辑-资源描述']), expectList[4])
    assert_equal(locate_text(self, resources['新增编辑-当前选中资源状态']), expectList[5])
    locate_click(self, resources['新增编辑-资源地图'])
    assert_equal(get_input_value(self, resources['新增编辑-资源地图经度']), expectList[6])
    assert_equal(get_input_value(self, resources['新增编辑-资源地图纬度']), expectList[7])
    locate_click(self, resources['新增编辑-资源地图取消'])
    locate_click(self, resources['新增编辑-资源图片按钮'])
    assert_img_locate(self, expectList[8], resources['新增编辑-放大后资源图片'])
    locate_click(self, resources['新增编辑-放大后资源图片关闭'])


def resource_del(self, resource_type=None, resource_name=None):
    """
    删除资源，列表挨个删，删之前判断一下是不是当前的重要资源分类
    :param self:
    :param resource_type:资源类型
    :param resource_name:资源名称
    :return:
    """
    while True:
        if resource_type is not None:
            assert_str_elements(self, resource_type, resources['分类资源列表-资源类别列'])
        if resource_name is not None:
            assert_str_in_elements(self, resource_name, resources['分类资源列表-资源名称列'])
        if element_exist_click(self, resources['资源列表第一行删除'], 1):
            locate_click(self, resources['分类资源-类别删除确认'])
            assert_str_element(self, '操作成功!', resources['资源列表成功提示'])
            time.sleep(1)
        else:
            break
# 分类资源---------------------------------------------------------------------------------


# 防火检查站---------------------------------------------------------------------------------
def assert_select_menu(self, one_menu, two_menu):
    """
    断言当前选中的一、二级菜单名字
    :param self:
    :param one_menu:一级菜单名
    :param two_menu:二级菜单名
    :return:
    """
    actual_lise = [one_menu, two_menu]
    assert_list_elements(self, device['当前选中一、二级菜单'], actual_lise)


def fireCheckpoint_search(self, name=None, type=None, state=None, audit_status=None):
    """
    防火检查站搜索，什么都不传会自动清空要传的值
    :param self:
    :param name: 检查站名称
    :param type: 建筑类型
    :param state: 状态
    :param audit_status:审核状态
    :return:
    """
    if name is not None:
        locate_input(self, device['防火检查站-名称搜索'], name)
    else:
        locate_clear(self, device['防火检查站-名称搜索'])
    if type is not None:
        locate_click(self, device['防火检查站-建筑类型下拉'])
        locates_last_click(self, f'//*[contains(text(), "{type}")]')
    else:
        if get_input_value(self, device['防火检查站-建筑类型下拉']) is not '':
            log.info(get_input_value(self, device['防火检查站-建筑类型下拉']))
            locate_slfh2_clear(self, device['防火检查站-建筑类型下拉'])
    if state is not None:
        locate_click(self, device['防火检查站-状态下拉'])
        locates_last_click(self, f'//*[contains(text(), "{state}")]')
    else:
        if get_input_value(self, device['防火检查站-状态下拉']) is not '':
            locate_slfh2_clear(self, device['防火检查站-状态下拉'])
    if audit_status is not None:
        locate_click(self, device['防火检查站-审核状态下拉'])
        locates_last_click(self, f'//*[contains(text(), "{audit_status}")]')
    else:
        if get_input_value(self, device['防火检查站-审核状态下拉']) is not '':
            locate_slfh2_clear(self, device['防火检查站-审核状态下拉'])


def fireCheckpoint_add_edit(self, department, name, admin, admin_company, tel, build_year, type, people_num, building_area, altitude, point, range, state, build_plan, remarks, positive_img, side_img, video, address):
    """
    新增和编辑防火检查站
    :param self:
    :param department:所属部门
    :param name:名称
    :param admin:管理人
    :param admin_company:管理单位
    :param tel:联系电话
    :param build_year:建设年度
    :param type:建筑类型
    :param people_num:人数
    :param building_area:建设面积
    :param altitude:海拔
    :param point:是否重点设施
    :param range:是否属于城市面山区范围
    :param state:是否启用
    :param build_plan:建设规划
    :param remarks:备注
    :param positive_img:正面图片
    :param side_img:侧面图片
    :param video:视频
    :param address:地址
    :return:
    """
    locate_click(self, device['防火检查站-新增编辑所属部门'])
    locate_input(self, device['防火检查站-新增编辑所属部门搜索'], department)
    locate_click(self, f'//*[contains(text(), "{department}")]/../label')
    locate_click(self, device['防火检查站-新增编辑空白处'])

    locate_input(self, device['防火检查站-新增编辑名称'], name)
    locate_input(self, device['防火检查站-新增编辑管理人'], admin)
    locate_input(self, device['防火检查站-新增编辑管理单位'], admin_company)
    locate_input(self, device['防火检查站-新增编辑联系电话'], tel)
    locate_input(self, device['防火检查站-新增编辑建设年度'], build_year)
    locate_click(self, device['防火检查站-新增编辑建筑类型'])
    locates_last_click(self, f'//*[contains(text(), "{type}")]')

    locate_input(self, device['防火检查站-新增编辑检查站人数'], people_num)
    locate_input(self, device['防火检查站-新增编辑建设面积'], building_area)
    locate_input(self, device['防火检查站-新增编辑海拔'], altitude)

    if point:
        locates_click(self, device['防火检查站-新增编辑是否重点设施'], 0)
    else:
        locates_click(self, device['防火检查站-新增编辑是否重点设施'], 1)

    if range:
        locates_click(self, device['防火检查站-新增编辑是否属于城市面山区范围'], 0)
    else:
        locates_click(self, device['防火检查站-新增编辑是否属于城市面山区范围'], 1)

    if state:
        locates_click(self, device['防火检查站-新增编辑是否启用'], 0)
    else:
        locates_click(self, device['防火检查站-新增编辑是否启用'], 1)

    locate_input(self, device['防火检查站-新增编辑备注'], remarks)
    locate_input(self, device['防火检查站-新增编辑建设规划'], build_plan)

    while True:
        if element_exist(self, device['防火检查站-新增编辑正面图片删除'], 1):
            mouse_hover(self, device['防火检查站-新增编辑正面图片删除悬停'])
            locate_click(self, device['防火检查站-新增编辑正面图片删除'])
        else:
            break
    if positive_img is not '':
        positive_img_list = positive_img.split(',')
        for img_name in positive_img_list:
            img_path = f'{path_expected_img}{img_name}'
            locate_sendImg(self, img_path, device['防火检查站-新增编辑正面图片'])

    while True:
        if element_exist(self, device['防火检查站-新增编辑侧面图片删除'], 1):
            mouse_hover(self, device['防火检查站-新增编辑侧面图片删除悬停'])
            locate_click(self, device['防火检查站-新增编辑侧面图片删除'])
        else:
            break
    if side_img is not '':
        side_img_list = side_img.split(',')
        for img_name in side_img_list:
            img_path = f'{path_expected_img}{img_name}'
            locate_sendImg(self, img_path, device['防火检查站-新增编辑侧面图片'])

    while True:
        if element_exist(self, device['防火检查站-新增编辑视频删除'], 1):
            mouse_hover(self, device['防火检查站-新增编辑视频删除悬停'])
            locate_click(self, device['防火检查站-新增编辑视频删除'])
        else:
            break
    if video is not '':
        video_list = video.split(',')
        for video_name in video_list:
            video_path = f'{path_expected_img}{video_name}'
            locate_sendImg(self, video_path, device['防火检查站-新增编辑视频'])

    locate_click(self, device['防火检查站-新增编辑地图'])
    locate_input(self, resources['新增编辑-资源地图搜索输入框'], address)
    locate_click(self, resources['新增编辑-资源地图搜索输入框'])
    # 可能有点卡，最多等6s
    element_exist(self, f"{resources['新增编辑-资源地图搜索下拉框']}[1]", 6)
    text = locate_text(self, f"{resources['新增编辑-资源地图搜索下拉框']}[1]")
    log.info(f'点击地图搜索下拉框第一个：{text}')
    locate_click(self, f"{resources['新增编辑-资源地图搜索下拉框']}[1]")
    time.sleep(2)
    if text == '中国石化光电园加油站':
        assert_str_element(self, '重庆市渝北区人和街道西郊汽车服务连锁光电园店', resources['新增编辑-资源地图详细地址'])
    locate_click(self, resources['新增编辑-资源地图确定'])


def fireCheckpoint_search_assert(self, expect_list):
    """
    防火检测站搜索第一行断言
    :param self:
    :param expect_list: 期望list
    :return:
    """
    assert_list_elements(self, device['防火检查站-列表第一行'], expect_list)


def fireCheckpoint_edit_assert(self, expectList):
    """
    防火检查站编辑后 断言
    :param self:
    :param expectList: 期望list
    :return:
    """
    log.info('文字按钮断言')
    assert_str_element(self, expectList[0], f"{device['防火检查站-新增编辑所属部门']}/div/div/span")
    assert_input_value(self, expectList[1], device['防火检查站-新增编辑名称'])
    assert_input_value(self, expectList[2], device['防火检查站-新增编辑管理人'])
    assert_input_value(self, expectList[3], device['防火检查站-新增编辑管理单位'])
    assert_input_value(self, expectList[4], device['防火检查站-新增编辑联系电话'])
    assert_input_value(self, expectList[5], device['防火检查站-新增编辑建设年度'])
    assert_input_value(self, expectList[6], f"{device['防火检查站-新增编辑建筑类型']}/div/input")
    assert_input_value(self, expectList[7], device['防火检查站-新增编辑检查站人数'])
    assert_input_value(self, expectList[8], device['防火检查站-新增编辑建设面积'])
    assert_input_value(self, expectList[9], device['防火检查站-新增编辑海拔'])
    assert_str_element(self, expectList[10], f"{device['防火检查站-新增编辑是否重点设施']}[contains(@class,'el-radio is-checked')]/span[2]")
    assert_str_element(self, expectList[11], f"{device['防火检查站-新增编辑是否属于城市面山区范围']}[contains(@class,'el-radio is-checked')]/span[2]")
    assert_str_element(self, expectList[12], f"{device['防火检查站-新增编辑是否启用']}[contains(@class,'el-radio is-checked')]/span[2]")
    assert_input_value(self, expectList[13], device['防火检查站-新增编辑建设规划'])
    assert_input_value(self, expectList[14], device['防火检查站-新增编辑备注'])

    log.info('地图地址断言')
    # 先断言地图，可以自动滑动到最下方，提前加载出图片出来
    locate_click(self, device['防火检查站-新增编辑地图'])
    assert_str_elements(self, expectList[18], resources['新增编辑-资源地图详细地址'])
    locate_click(self, resources['新增编辑-资源地图取消'])

    log.info('图片断言')
    positive_img_list = expectList[15].split(',')
    i = 0
    for positive_img in positive_img_list:
        log.info(f'断言正面图片:{positive_img}')
        locates_click(self, f"{device['防火检查站-新增编辑正面图片删除']}/../div", i)
        assert_img_locate(self, positive_img, resources['新增编辑-放大后资源图片'])
        locate_click(self, resources['新增编辑-放大后资源图片关闭'])
        i = i+1

    side_img_list = expectList[16].split(',')
    i = 0
    for side_img in side_img_list:
        log.info(f'断言侧面图片:{side_img}')
        locates_click(self, f"{device['防火检查站-新增编辑侧面图片删除']}/../div", i)
        assert_img_locate(self, side_img, resources['新增编辑-放大后资源图片'])
        locate_click(self, resources['新增编辑-放大后资源图片关闭'])
        i = i+1

    log.info('视频断言')
    if expectList[17] is not '':
        video_list = expectList[17].split(',')
        i = 0
        for video in video_list:
            log.info(f'断言视频:{video}')
            locates_click(self, f"{device['防火检查站-新增编辑视频删除']}/../div", i)
            assert_true(element_exist(self, resources['新增编辑-放大后资源视频']))
            locate_click(self, resources['新增编辑-放大后资源视频关闭'])
            i = i+1


def fireCheckpoint_del(self, resource_type=None, resource_name=None):
    """
    删除防火检查站资源，列表挨个删，删之前判断一下是不是当前的重要资源分类
    :param self:
    :param resource_type:资源类型
    :param resource_name:资源名称
    :return:
    """
    while True:
        if resource_type is not None:
            assert_str_elements(self, resource_type, device['防火检查站-列表建筑类型列'])
        if resource_name is not None:
            assert_str_in_elements(self, resource_name, device['防火检查站-列表名称列'])
        if element_exist_click(self, device['防火检查站-删除列'], 1):
            locate_click(self, resources['分类资源-类别删除确认'])
            assert_str_element(self, '删除成功', resources['资源列表成功提示'])
            time.sleep(1)
        else:
            break
# 防火检查站---------------------------------------------------------------------------------
















